import request from '@/utils/request'
import { Dictionary_URL } from '@/url/ihisOmpUrl'

/**
 * 字典数据列表
 * @param {*} parentDictionaryKey 
 * @returns 
 */
export function selectList(parentDictionaryKey) {
    return request({
        url: Dictionary_URL + `/selectList/${parentDictionaryKey}`,
        method: "get",
    })
}

/**
 * 数据元名称列表
 * @param {*} selectParentDataList 
 * @returns 
 */
export function selectParentDataList() {
    return request({
        url: Dictionary_URL + '/selectParentDataList',
        method: "get",
    })
}

/**
 * 分页查询
 * @param {*} page 
 * @param {*} size 
 * @param {*} searchMap 
 * @returns 
 */
export function search(page, size, searchMap) {
    return request({
        url: Dictionary_URL + `/search/${page}/${size}`,
        method: "post",
        data: searchMap
    })
}

/**
 * 新增字典数据
 * @param {*} pojo 
 * @returns 
 */
export function add(pojo) {
    return request({
        url: Dictionary_URL + '/add',
        method: 'post',
        data: pojo
    });
}

/**
 * 通过ID查询字典数据
 * @param {*} id 
 * @returns 
 */
export function getById(id) {
    return request({
        url: Dictionary_URL + `/get/${id}`,
        method: 'get'
    });
}

/**
 * 更新字典数据
 * @param {*} pojo 
 * @returns 
 */
export function update(pojo) {
    return request({
        url: Dictionary_URL + `/update/${pojo.dictionaryKey}`,
        method: 'post',
        data: pojo
    });
}

/**
 * 通过ID删除字典数据
 * @param {*} id 
 * @returns 
 */
export function deleteById(id) {
    return request({
        url: Dictionary_URL + `/delete/${id}`,
        method: 'get'
    });
}
